import request from "../../utils/request";

const BASE_GOODS_URL = "maimao_kill/kill/goods";
const BASE_KILL_URL = "maimao_kill/kill/doKill";
export default {

    /**
     * 秒杀商品申请报名
     * @returns {AxiosPromise}
     */
    queryKillOnShow() {
        return request({
            url: `${BASE_GOODS_URL}/killData`,
            method: 'get'
        })
    },

    getKillCode(killId) {
        return request({
            url: `${BASE_KILL_URL}/kill-code?killId=${killId}`,
            method: 'get',
            responseType: "arraybuffer"
        })
    },

    /**
     * 校验验证码
     */
    verifyImageCode(killId, code) {
        return request({
            url: `${BASE_KILL_URL}/verifyCode`,
            method: "post",
            data: {
                killId,
                code
            }
        })
    },
    /**
     * 秒杀
     */
    doKill(killId, code) {
        return request({
            url: `${BASE_KILL_URL}/kill0`,
            method: "post",
            data: {
                killId,
                code
            }
        })
    }


}




